<?php

namespace App\Http\Controllers\Home;


use App\Http\Controllers\Controller;
use App\Model\Category;
use App\Model\Webs;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //$this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index(Request $request)
    {
        $cate_id = $request->get('cate_id') ? $request->get('cate_id') : 1;

        //获取类别信息
        $cateList = Category::getCateList();
        //获取子类别和站点信息
        $webList = Category::getList($cate_id);
        foreach ($webList as &$cate){
            $cate['list'] = Webs::getWebList($cate['id']);
        }
        return view("home/index2",["cateList"=>$cateList,'webList'=>$webList]);
    }
}
